home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Applications / PICSee Dust 1.01 / Preferences source / PICS_CreatorPane.cpp < prev    next >
C/C++ Source or Header  |  1995-11-16  |  4KB  |  111 lines

  1. #include "PICS_PreferencesPanes.h"
  2. #include "PICS_Types.h"
  3. #include "OSTypes.h"
  4.  
  5. enum {
  6.     // Creator pane    
  7.     kCreatorPane_PhotoShopCreatorRadio = kPrefsDlog_LastItem,
  8.     kCreatorPane_ColorItCreatorRadio,
  9.     kCreatorPane_OtherCreatorRadio,
  10.     kCreatorPane_GetAppCreatorRadio,
  11.  
  12.     kCreatorPane_AppCreatorText,
  13.     
  14.     kCreatorPane_LineSeparator,
  15.     kCreatorPane_Box
  16. };
  17.  
  18. // ---------------------------------------------------------------------------
  19.  
  20. void PrefsDialogSetupCreatorPane(DialogPtr prefsDlog) {
  21.     // PICT creator types
  22.     if ((**sPrefsData->prefs).pictCreatorType == kPhotoShopCreatorType) {
  23.         SelectRadioBtn(prefsDlog, kCreatorPane_PhotoShopCreatorRadio,
  24.             kCreatorPane_PhotoShopCreatorRadio,
  25.             kCreatorPane_OtherCreatorRadio);
  26.     }
  27.     else if ((**sPrefsData->prefs).pictCreatorType == kColorItCreatorType) {
  28.         SelectRadioBtn(prefsDlog, kCreatorPane_ColorItCreatorRadio,
  29.             kCreatorPane_PhotoShopCreatorRadio,
  30.             kCreatorPane_OtherCreatorRadio);
  31.     }
  32.     else {
  33.         SelectRadioBtn(prefsDlog, kCreatorPane_OtherCreatorRadio,
  34.             kCreatorPane_PhotoShopCreatorRadio,
  35.             kCreatorPane_OtherCreatorRadio);
  36.     }
  37.  
  38.     Str15 creatorStr;
  39.     creatorStr[0] = 4;
  40.     BlockMove(&(**sPrefsData->prefs).pictCreatorType, &creatorStr[1], sizeof(OSType));
  41.     SetDItemText(prefsDlog, kCreatorPane_AppCreatorText, creatorStr);
  42. } // END PrefsDialogSetupCreatorPane
  43.  
  44. // ---------------------------------------------------------------------------
  45.  
  46. Boolean PrefsDialogGetCreatorPaneSettings(DialogPtr prefsDlog) {
  47.     // Get PICT creator type
  48.     if (GetDlogCtlValue(prefsDlog, kCreatorPane_PhotoShopCreatorRadio)) {
  49.         (**sPrefsData->prefs).pictCreatorType = kPhotoShopCreatorType;
  50.     }
  51.     else if (GetDlogCtlValue(prefsDlog, kCreatorPane_ColorItCreatorRadio)) {
  52.         (**sPrefsData->prefs).pictCreatorType = kColorItCreatorType;
  53.     }
  54.     else {
  55.         Str15 osStr;
  56.         GetDialogItemText(GetDItemHdl(prefsDlog, kCreatorPane_AppCreatorText), osStr);
  57.         StringToOSType(osStr, &(**sPrefsData->prefs).pictCreatorType);
  58.     }
  59.     
  60.     return(true);
  61. } // END PrefsDialogGetCreatorPaneSettings
  62.  
  63. // ---------------------------------------------------------------------------
  64.  
  65. void PrefsDialogCreatorPaneHit(DialogPtr prefsDlog, short itemHit) {
  66.     switch(itemHit) {
  67.         case kCreatorPane_PhotoShopCreatorRadio:
  68.         case kCreatorPane_ColorItCreatorRadio:
  69.         case kCreatorPane_OtherCreatorRadio:
  70.             SelectRadioBtn(prefsDlog, itemHit,
  71.                 kCreatorPane_PhotoShopCreatorRadio, kCreatorPane_OtherCreatorRadio);
  72.         break;
  73.  
  74.         case kCreatorPane_GetAppCreatorRadio:
  75.             OSType creatorType;
  76.             if (GetAppCreatorType(&creatorType)) {
  77.                 Str15 osStr;
  78.                 OSTypeToString(creatorType, osStr);
  79.                 SetDItemText(prefsDlog, kCreatorPane_AppCreatorText, osStr);
  80.                 SelectRadioBtn(prefsDlog, kCreatorPane_OtherCreatorRadio,
  81.                     kCreatorPane_PhotoShopCreatorRadio,
  82.                     kCreatorPane_OtherCreatorRadio);
  83.             }
  84.         break;
  85.     }
  86. } // END PrefsDialogCreatorPaneHit
  87.  
  88. // ---------------------------------------------------------------------------
  89.  
  90. void PrefsDialogCreatorPaneUpdate(DialogPtr prefsDlog, EventRecord *theEvt, Boolean frontMost) {
  91.     Rect lineRect;
  92.     
  93.     GetDItemRect(prefsDlog, kCreatorPane_Box, &lineRect);
  94.     GrayDrawShadowBox(&lineRect, NULL);
  95.     
  96.     GetDItemRect(prefsDlog, kCreatorPane_LineSeparator, &lineRect);
  97.     GrayDrawShadowLine(&lineRect, NULL);
  98. } // END PrefsDialogCreatorPaneUpdate
  99.  
  100. // ---------------------------------------------------------------------------
  101.  
  102. void PrefsDialogCreatorPaneActivate(DialogPtr prefsDlog, Boolean activate) {
  103.     short hiliteMode = activate ? 0 : 255;
  104.     
  105.     for (short i = kCreatorPane_PhotoShopCreatorRadio;
  106.         i <= kCreatorPane_GetAppCreatorRadio; i++) {
  107.         HiliteControl((ControlHandle)GetDItemHdl(prefsDlog, i), hiliteMode);
  108.     }
  109. } // END PrefsDialogCreatorPaneActivate
  110.  
  111.